package com.ltkj.shop.service.impl;

import java.util.List;
import com.ltkj.common.core.utils.DateUtils;
import com.ltkj.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ltkj.shop.mapper.ShopRestMenuTypeMapper;
import com.ltkj.shop.domain.ShopRestMenuType;
import com.ltkj.shop.service.IShopRestMenuTypeService;

/**
 * 餐饮菜品类型Service业务层处理
 * 
 * @author xupf
 * @date 2023-10-07
 */
@Service
public class ShopRestMenuTypeServiceImpl implements IShopRestMenuTypeService 
{
    @Autowired
    private ShopRestMenuTypeMapper shopRestMenuTypeMapper;

    /**
     * 查询餐饮菜品类型
     * 
     * @param id 餐饮菜品类型主键
     * @return 餐饮菜品类型
     */
    @Override
    public ShopRestMenuType selectShopRestMenuTypeById(Long id)
    {
        return shopRestMenuTypeMapper.selectShopRestMenuTypeById(id);
    }

    /**
     * 查询餐饮菜品类型列表
     * 
     * @param shopRestMenuType 餐饮菜品类型
     * @return 餐饮菜品类型
     */
    @Override
    public List<ShopRestMenuType> selectShopRestMenuTypeList(ShopRestMenuType shopRestMenuType)
    {
        return shopRestMenuTypeMapper.selectShopRestMenuTypeList(shopRestMenuType);
    }

    /**
     * 新增餐饮菜品类型
     * 
     * @param shopRestMenuType 餐饮菜品类型
     * @return 结果
     */
    @Override
    public int insertShopRestMenuType(ShopRestMenuType shopRestMenuType)
    {
        shopRestMenuType.setCreateBy(SecurityUtils.getLoginUser().getUsername());
        shopRestMenuType.setCreateTime(DateUtils.getNowDate());
        return shopRestMenuTypeMapper.insertShopRestMenuType(shopRestMenuType);
    }

    /**
     * 修改餐饮菜品类型
     * 
     * @param shopRestMenuType 餐饮菜品类型
     * @return 结果
     */
    @Override
    public int updateShopRestMenuType(ShopRestMenuType shopRestMenuType)
    {
        shopRestMenuType.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
        shopRestMenuType.setUpdateTime(DateUtils.getNowDate());
        return shopRestMenuTypeMapper.updateShopRestMenuType(shopRestMenuType);
    }

    /**
     * 批量删除餐饮菜品类型
     * 
     * @param ids 需要删除的餐饮菜品类型主键
     * @return 结果
     */
    @Override
    public int deleteShopRestMenuTypeByIds(Long[] ids)
    {
        return shopRestMenuTypeMapper.deleteShopRestMenuTypeByIds(ids);
    }

    /**
     * 删除餐饮菜品类型信息
     * 
     * @param id 餐饮菜品类型主键
     * @return 结果
     */
    @Override
    public int deleteShopRestMenuTypeById(Long id)
    {
        return shopRestMenuTypeMapper.deleteShopRestMenuTypeById(id);
    }
}
